package com.zy.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zy.service.CustomerService;
import com.zy.service.impl.CustomerServiceImpl;
import com.zy.utils.LimitUtil;

/**
 * Servlet implementation class PageLimitServlet
 */
@WebServlet("/PageLimitServlet")
public class PageLimitServlet extends HttpServlet {
	
	 CustomerService cs=new CustomerServiceImpl();
   
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
		//接收参数
		String parameter = request.getParameter("currentPage");
		if(parameter!=null){
		int currentPage=Integer.parseInt(parameter);
		
		LimitUtil customerInfo = cs.getCustomerInfo(currentPage);
			
		//存域
		request.setAttribute("pageBean", customerInfo);
		}
		
		
	 //跳转到分页页面
		request.getRequestDispatcher("/WEB-INF/customer/limitPage.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
